/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn;

import java.lang.reflect.Method;

/**
 * <p>Project: javase2203 - Reflection5
 * <p>Powered by webrx On 2022-08-12 09:05:26
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Reflection5 {
    public static void main(String[] args) throws Exception {
        Class<Book> c = Book.class;
        //c.getMethods() 获取所有public的方法
        //c.getDeclaredMethods() 获取所有方法，包括private

        Book book = c.getConstructor().newInstance();

        System.out.println(book.pf(6));

        Method pf = c.getMethod("pf",int.class);
        System.out.println(pf.invoke(book,3));


    }
}
